- Vorstellung des Openstreetmap (OSM) Projekts
- Welche OSM-Daten sind erhältlich?
- Vorstellung von Forschung die mit OSM-Daten durchgeführt wurde
11 Oktober 2018
OpenStreetMap.org ist ein im Jahre 2004 gegründetes internationales Projekt mit dem Ziel, eine freie Weltkarte zu erschaffen. Dafür sammeln wir weltweit Daten über Straßen, Eisenbahnen, Flüsse, Wälder, Häuser und vieles mehr.
OpenStreetMap (OSM) ist ein kollaboratives Projekt um eine editierbare Weltkarte zu erzeugen.
https://mapzen.com/ - Ausschnitte von OpenStreetMap für einzelne Städte (metro extracts)
Über Geofabrik lassen sich aktuelle Ausschnitte (auch Shapefiles) herunterladen (http://download.geofabrik.de/)
Kartendaten (openaprs)
PostgreSQL hat den Vorteil, dass es Open-Source ist.
Hier ist eine Einführung in PostgreSQL zu finden
Beispiel: um Verknüpfung zu einer Datenbank herzustellen - Doppelklick auf den Server in pgAdmin III
CREATE EXTENSION postgis;
osm2pgsql -c -d osmBerlin --slim -C -k berlin-latest.osm.pbf
Wiki zum Downlaod von Openstreetmap Daten
Liste möglicher Datenquellen für räumliche Analysen (weltweit und in Deutschland )
SALB - Administrative Grenzen
Geocoding (…) uses a description of a location, most typically a postal address or place name, to find geographic coordinates from spatial reference data …
ggmaplibrary(ggmap)
geocode("Heidelberg")
Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=Heidelberg&sensor=false
lon lat
1 8.672434 49.39875
mapdist("Q1, 4 Mannheim","B2, 1 Mannheim")
mapdist("Q1, 4 Mannheim","B2, 1 Mannheim",mode="walking")
mapdist("Q1, 4 Mannheim","B2, 1 Mannheim",mode="bicycling")
tmaptoolstmaptools wird die Nominatim API zur Geokodierung verwendet.library("tmaptools")
cities <- c("Hamburg","Koeln","Dresden","Muenchen")
lat <- vector()
lon <- vector()
for (i in 1:length(cities)){
gc <- geocode_OSM(cities[i])
lat[i] <- gc$coords[1]
lon[i] <- gc$coords[2]
}
Dat <- data.frame(cities,lon,lat) kable(Dat)
| cities | lon | lat |
|---|---|---|
| Hamburg | 53.55034 | 10.000654 |
| Koeln | 50.93836 | 6.959974 |
| Dresden | 51.04933 | 13.738144 |
| Muenchen | 48.13711 | 11.575382 |
MA_map <- qmap("Mannheim")
MA_map + geom_point(aes(x = x, y = y), data = ListPOI)
MA_map + geom_point(aes(x = x, y = y),col="red", data = ListPOI)
Reverse geocoding is the process of back (reverse) coding of a point location (latitude, longitude) to a readable address or place name. This permits the identification of nearby street addresses, places, and/or areal subdivisions such as neighbourhoods, county, state, or country.
Quelle: Wikipedia
revgeocode(c(48,8))
load("../data/addr_list_t_68239.RData")
head(addr_list_t)
## [1] "Lilienstraße 32A, 68535 Edingen-Neckarhausen, Germany" ## [2] "Waldspitze 6, 68239 Mannheim, Germany" ## [3] "Holzweg 51, 68239 Mannheim, Germany" ## [4] "Kloppenheimer Str. 247, 68239 Mannheim, Germany" ## [5] "Mallaustraße 121, 68219 Mannheim, Germany" ## [6] "Holzweg 33A, 68239 Mannheim, Germany"
geocode_OSM(addr_list_t[1])
## $query ## [1] "Lilienstraße 32A, 68535 Edingen-Neckarhausen, Germany" ## ## $coords ## x y ## 8.584601 49.445360 ## ## $bbox ## min max ## x 8.584494 8.584708 ## y 49.445276 49.445443
gc_list <- list()
for (i in 1:length(addr_list_t)){
gc_list[[i]] <- geocode_OSM(addr_list_t[i])
}
opencagelibrary(opencage)
gc_info<-opencage_forward(placename =
"Amsterdam, Van Woustraat")
geonamesinstall.packages("geonames")
geonameszu nutzen.library(geonames)
options(geonamesUsername="myusername")
MAwiki<-GNfindNearbyWikipedia(postalcode=68239,country="DE",
radius=10)
| elevation | feature | lng | distance | countryCode | rank | lang | title | lat | wikipediaUrl | summary | thumbnailImg | geoNameId |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 102 | city | 8.46711 | 0.1738 | DE | 98 | en | Quadratestadt | 49.48848 | en.wikipedia.org/wiki/Quadratestadt | NA | NA | NA |
| 103 | landmark | 8.46212 | 0.1986 | NA | 90 | en | Reiss Engelhorn Museum | 49.48888 | en.wikipedia.org/wiki/Reiss_Engelhorn_Museum | The Reiss Engelhorn Museum, or (rem for short), is a museum in Mannheim, Germany. They have an exhibition area of , and house around 1.2 million objects. They are one of the largest publicly-owned museums in southern Germany (…) | http://www.geonames.org/img/wikipedia/29000/thumb-28652-100.jpg | NA |
| 103 | landmark | 8.4616 | 0.2423 | DE | 13 | en | Klapsmühl’ am Rathaus | 49.4891 | en.wikipedia.org/wiki/Klapsm%C3%BChl%E2%80%99_am_Rathaus | Klapsmühl’ am Rathaus is a theatre in Baden-Württemberg, Germany. | NA | NA |
| 104 | landmark | 8.46294 | 0.3178 | DE | 84 | en | GESIS – Leibniz Institute for the Social Sciences | 49.485686 | en.wikipedia.org/wiki/GESIS_%E2%80%93_Leibniz_Institute_for_the_Social_Sciences | The GESIS – Leibniz-Institute for the Social Sciences headquartered in Mannheim with locations in Cologne and Berlin is the largest German infrastructure institute for the Social Sciences. With basic research-based services and consulting covering all levels of the scientific process GESIS supports (…) | NA | NA |
| 102 | city | 8.4691 | 0.3258 | DE | 100 | en | Mannheim | 49.489 | en.wikipedia.org/wiki/Mannheim | Mannheim (listen, Palatine German: Monnem or Mannem) is a city in the southwestern part of Germany, the third-largest in the German state of Baden-Württemberg after Stuttgart and Karlsruhe. Mannheim is among the twenty largest cities in Germany, with a 2012 population of approximately 295,000 (…) | NA | 2873891 |
library(osmdata)
bbox <- getbb("Mannheim")
erg <- geonames::GNcities(49.649591,8.627236,
49.329591,8.307236)
googlewayAccesses Google Maps APIs to Retrieve Data and Plot Maps
library(googleway)
bboxDas Paket bbox ist auf github zu finden.
Beispieldatensatz laden:
load("../data/ddat.RData")
library(bbox) b_box(ddat)
## [1] 5.866286 47.273602 15.048632 55.058262
citation("bbox")
ggmapDie Vignette zum Paket tmap - tmap: get started
latlong.net - eine Homepage um Koordinaaten zu bestimmen.
<www.openstreetmap.org/export>
osm export
XML - Gaston Sanchezlibrary("XML")
Seine Arbeit sieht man hier.
Gaston Sanchez - Webdaten bekommen
| Function | Description |
|---|---|
| xmlName() | name of the node |
| xmlSize() | number of subnodes |
| xmlAttrs() | named character vector of all attributes |
| xmlGetAttr() | value of a single attribute |
| xmlValue() | contents of a leaf node |
| xmlParent() | name of parent node |
| xmlAncestors() | name of ancestor nodes |
| getSibling() | siblings to the right or to the left |
| xmlNamespace() | the namespace (if there’s one) |
<www.openstreetmap.org/export>
osm export
Administrative Grenzen für Deutschland
url <- "https://api.openstreetmap.org/api/0.6/relation/62422"
BE <- xmlParse(url)
BE <- xmlParse("../data/62422.xml")
Administrative Grenzen Berlin
xmltop = xmlRoot(BE) class(xmltop)
## [1] "XMLInternalElementNode" "XMLInternalNode" ## [3] "XMLAbstractNode"
xmlSize(xmltop)
## [1] 1
xmlSize(xmltop[[1]])
## [1] 337
Xpath, the XML Path Language, is a query language for selecting nodes from an XML document.
xpathApply(BE,"//tag[@k = 'population']")
## [[1]] ## <tag k="population" v="3440441"/> ## ## attr(,"class") ## [1] "XMLNodeSet"
xpathApply(BE,"//tag[@k = 'source:population']")
## [[1]] ## <tag k="source:population" v="http://www.statistik-berlin-brandenburg.de/Publikationen/Stat_Berichte/2010/SB_A1-1_A2-4_q01-10_BE.pdf 2010-10-01"/> ## ## attr(,"class") ## [1] "XMLNodeSet"
xpathApply(BE,"//tag[@k = 'name:ta']")
## [[1]] ## <tag k="name:ta" v="<U+0BAA><U+0BC6><U+0BB0><U+0BCD><U+0BB2><U+0BBF><U+0BA9><U+0BCD>"/> ## ## attr(,"class") ## [1] "XMLNodeSet"
region <- xpathApply(BE, "//tag[@k = 'geographical_region']") # regular expressions region[[1]]
## <tag k="geographical_region" v="Barnim;Berliner Urstromtal;Teltow;Nauener Platte"/>
<tag k="geographical_region" v="Barnim;Berliner Urstromtal; Teltow;Nauener Platte"/>
Barnim
url2<-"http://api.openstreetmap.org/api/0.6/node/25113879" obj2<-xmlParse(url2) obj_amenity<-xpathApply(obj2,"//tag[@k = 'amenity']")[[1]] obj_amenity
## <tag k="amenity" v="university"/>
xpathApply(obj2,"//tag[@k = 'wikipedia']")[[1]]
## <tag k="wikipedia" v="de:Universität Mannheim"/>
xpathApply(obj2,"//tag[@k = 'wheelchair']")[[1]]
xpathApply(obj2,"//tag[@k = 'name']")[[1]]
url3<-"http://api.openstreetmap.org/api/0.6/node/303550876" obj3 <- xmlParse(url3) xpathApply(obj3,"//tag[@k = 'opening_hours']")[[1]]
## <tag k="opening_hours" v="Mo-Sa 09:00-20:00; Su,PH off"/>
url4<-"http://api.openstreetmap.org/api/0.6/node/25439439" obj4 <- xmlParse(url4) xpathApply(obj4,"//tag[@k = 'railway:station_category']")[[1]]
## <tag k="railway:station_category" v="2"/>
library(rvest) bhfkat<-read_html( "https://de.wikipedia.org/wiki/Bahnhofskategorie") df_html_bhfkat<-html_table( html_nodes(bhfkat, "table")[[2]],fill = TRUE)
| Stufe | Bahnsteigkanten | Bahnsteiglänge[Anm 1] | Reisende/Tag | Zughalte/Tag | Service[Anm 2] | Stufenfreiheit[Anm 3] |
|---|---|---|---|---|---|---|
| (0) | — | — | — | — | Nein | Nein |
| 1 | 01 | > 000 bis 090 m | 00.000 bis 00.049 | 000 bis 0010 | Ja | Ja |
| 2 | 02 | > 090 bis 140 m | 00.050 bis 00.299 | 011 bis 0050 | — | — |
| 3 | 03 bis 04 | > 140 bis 170 m | 00.300 bis 0.0999 | 051 bis 0100 | — | — |
| 4 | 05 bis 09 | > 170 bis 210 m | 01.000 bis 09.999 | 101 bis 0500 | — | — |
| 5 | 10 bis 14 | > 210 bis 280 m | 10.000 bis 49.999 | 501 bis 1000 | — | — |
| 6 | 00i ab 15 | > 280 m bis 000 | 000000 ab 50.000 | 000i ab 1001 | — | — |
| Gewichtung | 20 % | 20 % | 20 % | 20 % | 15 % | 5 % |
url5<-"http://api.openstreetmap.org/api/0.6/way/162149882" obj5<-xmlParse(url5) xpathApply(obj5,"//tag[@k = 'name']")[[1]]
## <tag k="name" v="City-Airport Mannheim"/>
xpathApply(obj5,"//tag[@k = 'website']")[[1]]
## <tag k="website" v="http://www.flugplatz-mannheim.de/"/>
xpathApply(obj5,"//tag[@k = 'iata']")[[1]]
## <tag k="iata" v="MHG"/>
osmar benutzenlibrary("osmar")
node_ <- xmlParse("../data/162149882.xml")
node_osmar <- as_osmar(node_)
node_osmar
## osmar object ## 0 nodes, 1 ways, 0 relations
sflibrary(sf)
st_layers kann man sehen, welche Layer verfügbar sind:st_layers("../data/Amsterdam_highway_primary.osm")
## Driver: OSM ## Available layers: ## layer_name geometry_type features fields ## 1 points Point NA 10 ## 2 lines Line String NA 9 ## 3 multilinestrings Multi Line String NA 4 ## 4 multipolygons Multi Polygon NA 25 ## 5 other_relations Geometry Collection NA 4
linesdat <- st_read("../data/Amsterdam_highway_primary.osm","lines")
## Reading layer `lines' from data source `D:\Daten\GitHub\geocourse\data\Amsterdam_highway_primary.osm' using driver `OSM' ## Simple feature collection with 1464 features and 9 fields ## geometry type: LINESTRING ## dimension: XY ## bbox: xmin: 8.333102 ymin: 49.32801 xmax: 8.627991 ymax: 49.65208 ## epsg (SRID): 4326 ## proj4string: +proj=longlat +datum=WGS84 +no_defs
plot(dat$geometry)
pointsdatp <- st_read("../data/Amsterdam_highway_primary.osm","points")
## Reading layer `points' from data source `D:\Daten\GitHub\geocourse\data\Amsterdam_highway_primary.osm' using driver `OSM' ## Simple feature collection with 800 features and 10 fields ## geometry type: POINT ## dimension: XY ## bbox: xmin: 8.33654 ymin: 49.32801 xmax: 8.626969 ymax: 49.65208 ## epsg (SRID): 4326 ## proj4string: +proj=longlat +datum=WGS84 +no_defs
plot(dat$geometry,pch=20,col=rgb(0,0,1,.1))
library(tmap) qtm(dat$geometry)
st_layers("../data/ams_centraal.osm")
## Driver: OSM ## Available layers: ## layer_name geometry_type features fields ## 1 points Point NA 10 ## 2 lines Line String NA 9 ## 3 multilinestrings Multi Line String NA 4 ## 4 multipolygons Multi Polygon NA 25 ## 5 other_relations Geometry Collection NA 4
datm <- st_read("../data/ams_centraal.osm","multipolygons")
## Reading layer `multipolygons' from data source `D:\Daten\GitHub\geocourse\data\ams_centraal.osm' using driver `OSM' ## Simple feature collection with 2796 features and 25 fields ## geometry type: MULTIPOLYGON ## dimension: XY ## bbox: xmin: 4.874776 ymin: 52.36088 xmax: 4.929755 ymax: 52.39393 ## epsg (SRID): 4326 ## proj4string: +proj=longlat +datum=WGS84 +no_defs
sp::plot(datm$geometry)
Deborah Nolan - Extracting data from XML
Duncan Temple Lang - A Short Introduction to the XML package for R
citation("XML")
##
## To cite package 'XML' in publications use:
##
## Duncan Temple Lang and the CRAN Team (2018). XML: Tools for
## Parsing and Generating XML Within R and S-Plus. R package
## version 3.98-1.12. https://CRAN.R-project.org/package=XML
##
## A BibTeX entry for LaTeX users is
##
## @Manual{,
## title = {XML: Tools for Parsing and Generating XML Within R and S-Plus},
## author = {Duncan Temple Lang and the CRAN Team},
## year = {2018},
## note = {R package version 3.98-1.12},
## url = {https://CRAN.R-project.org/package=XML},
## }
##
## ATTENTION: This citation information has been auto-generated from
## the package DESCRIPTION file and may need manual editing, see
## 'help("citation")'.
citation("xml2")
##
## To cite package 'xml2' in publications use:
##
## Hadley Wickham, James Hester and Jeroen Ooms (2018). xml2: Parse
## XML. R package version 1.2.0.
## https://CRAN.R-project.org/package=xml2
##
## A BibTeX entry for LaTeX users is
##
## @Manual{,
## title = {xml2: Parse XML},
## author = {Hadley Wickham and James Hester and Jeroen Ooms},
## year = {2018},
## note = {R package version 1.2.0},
## url = {https://CRAN.R-project.org/package=xml2},
## }
Das R-Paket osmdata mit dem man OSM-Daten herunterladen kann und das auf der Overpass API beruht.
Das Paket osmplotr
osmdata PaketMark Padgham - Import 'OpenStreetMap' Data as Simple Features or Spatial Objects
osmdata Paketinstall.packages("osmdata")
library(osmdata)
citation("osmdata")
osmplotrlibrary("osmplotr")
library("osmdata")
bbox <- getbb("Mannheim")
dat_osm <- extract_osm_objects(key='building',
value="kindergarten",
bbox=bbox)
q <- opq(bbox = c(52.3, 4.7, 52.4, 5.1))
getbb verwendet:bb <- getbb('Ladenburg')
In bb sind nun vier Werte gespeichert, die den Rahmen definieren
Befehl opq - eine Overpass Anfrage erstellen
q <- opq(bbox = bb)
format_out=polygon Befehl getbb erhält man das Polygon:bb_poly <- getbb(place_name = "Ladenburg",
format_out = "polygon")
## [,1] [,2] ## [1,] 8.569720 49.49107 ## [2,] 8.569858 49.49101 ## [3,] 8.569999 49.49096 ## [4,] 8.570342 49.49085
sf)Simple Features for R
sf ist ein Paket um geometrische Operationen durchzuführen.library(sf)
st_linestringCreate simple feature from a numeric vector, matrix or list
library(sf) ls <- st_linestring(bb_poly) sfc <- st_sfc(ls)
linestring plottenlibrary(tmap) qtm(sfc)
Alle benannten Objekte findet man, wenn man OSM map features in eine Suchmaschine eingibt.
Achtung, wenn man bspw. alle Objekte mit dem Schlüssel amenity für eine Stadt heraussucht, bekommt man einen recht großen Datensatz
q <- add_osm_feature (q, key = 'amenity') osmdata_xml(q, '../data/Ladenburg_amenity.osm')
osmdata_sfosmdata_sf gibt ein osmdata ObjeKt im sf Format.library(magrittr)
dat1 <- opq(bbox = 'Ladenburg') %>%
add_osm_feature(key = 'shop', value = 'bakery') %>%
osmdata_sf ()
unlist(lapply(dat1,nrow))
## osm_points osm_lines osm_polygons osm_multilines ## 16 0 0 0 ## osm_multipolygons ## 0
tmaplibrary(tmap) tm_shape(sfc) tm_bubbles(dat, size=2)
q <- add_osm_feature (q, key = 'amenity',value = "bicycle_parking") osmdata_xml(q, '../data/Amsterdam_amenity_bicycle_parking.osm')
dat <- sf::st_read ('../data/Amsterdam_amenity_bicycle_parking.osm',
layer = 'points',
quiet = TRUE)
library(tmap) qtm(dat)
dat <- sf::st_read ('../data/Amsterdam_amenity.osm',
layer = 'points',
quiet = TRUE)
nrow(dat) names(dat)
?add_osm_feature
q <- opq (bbox = 'Mannheim') q <- add_osm_feature (q, key ="amenity",value = 'bar') osmdata_xml (q, 'data/Mannheim_bar.osm')
dat_bar <- sf::st_read ('../data/Mannheim_bar.osm',
layer = 'points', quiet = TRUE)
q <- opq (bbox = 'Amsterdam')
q <- add_osm_feature (q, key ="amenity",
value = 'bus_station')
osmdata_xml (q, 'data/Amsterdam_bus_station.osm')
dat_bus <- sf::st_read ('../data/Amsterdam_bus_station.osm',
layer = 'points', quiet = TRUE)
nrow(dat_bus)
?sf::st_read
q <- opq (bbox = 'Amsterdam')
q <- add_osm_feature (q, key ="public_transport",
value = 'station')
osmdata_xml (q, '../data/Amsterdam_bus_pubtrans.osm')
dat_bus <- sf::st_read ('../data/Amsterdam_bus_pubtrans.osm',
layer = 'points', quiet = TRUE)
nrow(dat_bus)
dat3 <- opq(bbox = 'Amsterdam') %>%
add_osm_feature(key = 'railway',
value = 'tram_stop') %>%
osmdata_sf ()
dat3$osm_points$geometry
# install.packages("osmplotr")
library("osmplotr")
bbox <- getbb("Amsterdam")
dat_pa <- extract_osm_objects(key='highway',
value="primary",
bbox=bbox)
dat_sa <- extract_osm_objects(key='highway',
value="secondary",
bbox=bbox)
dat_ta <- extract_osm_objects(key='highway',
value="tertiary",
bbox=bbox)
map <- osm_basemap(bbox = bbox, bg = c("#F5F5DC"))
map <- add_osm_objects(map, dat_pa, col = c("#00008B"))
map <- add_osm_objects(map, dat_sa, col = "green")
map <- add_osm_objects(map, dat_ta, col = "lightblue")
map <- add_osm_objects(map, dat3$osm_points, col = c("red"))
print_osm_map(map)
features <- available_features() head(features,n=20)
## [1] "4wd only" "abandoned" ## [3] "abutters" "access" ## [5] "addr" "addr:city" ## [7] "addr:conscriptionnumber" "addr:country" ## [9] "addr:district" "addr:flats" ## [11] "addr:full" "addr:hamlet" ## [13] "addr:housename" "addr:housenumber" ## [15] "addr:inclusion" "addr:interpolation" ## [17] "addr:place" "addr:postcode" ## [19] "addr:province" "addr:state"
api_list <- c('http://overpass-api.de/api/interpreter',
'https://lz4.overpass-api.de/api/interpreter',
'https://z.overpass-api.de/api/interpreter',
'https://overpass.kumi.systems/api/interpreter')
api_to_use <- sample(1:length(api_list), 1)
set_overpass_url(api_list[api_to_use])
osmdata# https://rdrr.io/cran/osmdata/man/osmdata_sp.html ?osmdata_sp
http://wiki.openstreetmap.org/wiki/Overpass_API
url <- "https://raw.githubusercontent.com/Japhilko/ GeoData/master/2015/data/CampSites_Germany.csv"
CampSites <- read.csv(url)
| X | name | tourism | website |
|---|---|---|---|
| 1 | Campingplatz Winkelbachtal | camp_site | http://www.gruibingen.de/campingplatz.html |
| 2 | Radler-Zeltplatz | camp_site | NA |
| 3 | Campingplatz des Naturfreundehauses | camp_site | NA |
| 4 | Campingplatz Am Aichstruter Stausee | camp_site | NA |
| 5 | NA | camp_site | NA |
| 6 | Kandern | camp_site | NA |
| 7 | Campingplatz Baiersbronn-Obertal | camp_site | NA |
| 8 | Campingplatz Schwabenmühle | camp_site | NA |
magrittr - für den Pipe Operator in R:
library("magrittr")
leaflet - um interaktive Karten mit der JavaScript Bibliothek 'Leaflet' zu erzeugen
library("leaflet")
leaflet()%>% addTiles()
Hallo Leaflet
leaflet() %>%
addTiles() %>%
addMarkers(lng=8.456597, lat=49.48738,
popup="Wo wir sind")
m <- leaflet() %>%
addTiles() %>%
addMarkers(lng=CampSites$lon,
lat=CampSites$lat,
popup=CampSites$name)
m
m %>% addProviderTiles("Stamen.Toner")
Eine Stamen Karte als Hintergrund
m %>% addProviderTiles("CartoDB.Positron")
CartoDB als Hintergrund
m %>% addProviderTiles("NASAGIBS.ViirsEarthAtNight2012")
Lichter der Nacht
popupInfo <- paste(CampSites$name,"\n",CampSites$website)
m <- leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addMarkers(lng=CampSites$lon,
lat=CampSites$lat,
popup=popupInfo)
m
Das Ergebnis ist hier:
Campingplätze in Deutschland
Camping Mannheim
Ich hab die Ergebnisse hochgeladen:
Publizieren auf Rpubs
url <- "https://raw.githubusercontent.com/Japhilko/ GeoData/master/2015/data/whcSites.csv" whcSites <- read.csv(url)
m <- leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addMarkers(lng=whcSites$lon,
lat=whcSites$lat,
popup=whcSites$name_en)
m
Weltkulturerbestätten
whcSites$color <- "red" whcSites$color[whcSites$category=="Cultural"] <- "blue" whcSites$color[whcSites$category=="Mixed"] <- "orange"
m1 <- leaflet() %>%
addTiles() %>%
addCircles(lng=whcSites$lon,
lat=whcSites$lat,
popup=whcSites$name_en,
color=whcSites$color)
m1
Karte Weltkulturerbe
Als Website speichern
mapview - Beispieldatensatz Frankenlibrary(mapview) mapview(franconia)
mapviewmapview(leaflet::gadmCHE)
mapviewlibrary(mapedit) library(magrittr) lf <- mapview() drawing <- lf %>% editMap()
mapviewload("../data/spatsamp_68239.RData")
library(mapview) mapview(spatsamp)
leafletlibrary("tmaptools")
gc_tma <- geocode_OSM("Mannheim, GESIS")
library(leaflet) library(magrittr) m <- leaflet() %>% addTiles() %>% addMarkers(lng=8.463061 , lat=49.485736 , popup="GESIS Mannheim") m
geojsonRinstall.packages("geojsonR")
citation("geojsonR")
key=highway, value=bus_stopbus_stops <- geojsonio::geojson_read("../data/Amsterdam_bus_stop.geojson",
what = "sp")
sp::plot(bus_stops)
lawnVignette für das Paket lawn
lawn kann die Javascript-Bibliothek turf.js in R eingebunden werden.Weitere genutzte Javascript Bibliotheken (geojson-random und geojsonhint), werden verwendet um GeoJSON-Objekte zufällig zu erzeugen bzw. um die GeoJSON Objekte einzufärben.
install.packages("lawn")
citation("lawn")
library(lawn)
gr_polygon kann ein Beispielobjekt erzeugt werden.view plotten.a <- gr_polygon(n = 1, vertices = 5, max_radial_length = 5) view(a)
b <- gr_polygon(n = 1) view(b)
gcs <- geojsonio::geojson_read("../data/ddat.geojson")
view(gcs)
jsonlitelibrary(jsonlite)
geoc <- read_json("../data/ddat.geojson")
citation("jsonlite")
##
## To cite jsonlite in publications use:
##
## Jeroen Ooms (2014). The jsonlite Package: A Practical and
## Consistent Mapping Between JSON Data and R Objects.
## arXiv:1403.2805 [stat.CO] URL https://arxiv.org/abs/1403.2805.
##
## A BibTeX entry for LaTeX users is
##
## @Article{,
## title = {The jsonlite Package: A Practical and Consistent Mapping Between JSON Data and R Objects},
## author = {Jeroen Ooms},
## journal = {arXiv:1403.2805 [stat.CO]},
## year = {2014},
## url = {https://arxiv.org/abs/1403.2805},
## }
RJSONIOlibrary("RJSONIO")
con <- url("http://nominatim.openstreetmap.org/search?format=json&
addressdetails=1&extratags=1&q=Amsterdam+Niederlande+Rozengracht+1")
geoc <- fromJSON(paste(readLines(con,warn=F),
collapse = ''))
close(con)